﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="WebFormDatHang.aspx.cs" Inherits="WebFormDatHang" %>


<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <link rel="stylesheet" href="Style/jquery-ui-1.10.3.custom.min.css" />
    <script type="text/javascript" src="Scripts/jquery-ui-1.10.3.custom.min.js"></script>

    <style type="text/css">
        .cbShowAll {
            margin-left: 500px;
        }
    </style>

    <script type="text/javascript">

        jQuery(function () {

            jQuery('.txtDateTime').datepicker({dateFormat: 'dd/mm/yy'});
            
            jQuery("#dialog").dialog({
                autoOpen: false,
                width: 500,
                height: 500
            });
        });

        function showPopup(maphieu) {

            jQuery.ajax({
                type: "POST",
                url: "WebFormDatHang.aspx/HienChiTietDatHang",
                data: "{'maphieu': '" + maphieu + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    try {
                        if (data!=null) {
                            jQuery("#dialog").html(data.d).dialog("open");
                        }
                    } catch (e) {
                        alert(e);
                    }
                },
                error: function (data, status, e) {
                    alert(e);
                }
            });
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div style="width: 100%">
        <div style="display: block">
            <asp:Label ID="lblNgay" runat="server" Text="Ngày"></asp:Label>
&nbsp;<asp:TextBox ID="txtDateTime" runat="server" CssClass="txtDateTime" />
            &nbsp;
            <asp:Button ID="btnTimKiem" runat="server" OnClick="btnTimKiem_Click" Text="Tìm kiếm" />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <asp:DropDownList ID="ddlHienThi" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlHienThi_SelectedIndexChanged">
                <asp:ListItem Value="1">Hiện đơn đặt hàng chưa giao</asp:ListItem>
                <asp:ListItem Value="2">Hiện toàn bộ đơn đặt hàng</asp:ListItem>
            </asp:DropDownList>
        </div>
        <br />
        <asp:GridView ID="gdvDatHang" runat="server" AutoGenerateColumns="False" CellPadding="3" Width="100%" BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" OnRowEditing="gdvDatHang_RowEditing" HeaderStyle-Height="30px" RowStyle-Height="30px" OnRowCommand="gdvDatHang_RowCommand" AllowPaging="True" OnPageIndexChanging="gdvDatHang_PageIndexChanging">
            <Columns>
                <asp:TemplateField HeaderText="Tài khoản đặt hàng">
                    <ItemTemplate>
                        <asp:Label ID="lblTaiKhoan" runat="server" Text='<%# Eval("TaiKhoan.TenTK") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Ngày đặt hàng">
                    <ItemTemplate>
                        <asp:Label ID="lblNgayDatHang" runat="server" Text='<%# Eval("NgayDatHang") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Tổng giá trị">
                    <ItemTemplate>
                        <asp:Label ID="lblTongGiaTri" runat="server" Text='<%# Eval("TongTien") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Người nhận">
                    <ItemTemplate>
                        <asp:Label ID="lblNguoiNhan" runat="server" Text='<%# Eval("TenNguoiNhan") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Số điện thoại">
                    <ItemTemplate>
                        <asp:Label ID="lblSoDienThoai" runat="server" Text='<%# Eval("SoDienThoai") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Địa chỉ giao hàng">
                    <ItemTemplate>
                        <asp:Label ID="lblDiaChiGiao" runat="server" Text='<%# Eval("DiaChi") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Trạng thái">
                    <ItemTemplate>
                        <asp:Label ID="lblTrangThai" runat="server" Text='<%# Eval("TrangThai") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Ngày giao hàng">
                    <ItemTemplate>
                        <asp:Label ID="lblNgayGiaoHang" runat="server" Text='<%# Eval("NgayGiaoHang") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField>
                    <ItemTemplate>
                        <%-- <asp:Button ID="btnChiTiet" runat="server" CommandName="Edit" Text="Xem chi tiết" CommandArgument='<%# Eval("MaPhieu") %>'
                                    OnClientClick='showPopup();return false();' UseSubmitBehavior="false" OrderID='<%#Eval("MaPhieu") %>'/>--%>
                        <input type="button" value="Xem chi tiết" onclick='showPopup(<%#Eval("MaPhieu") %>);' />
                        &nbsp;
                                    <asp:Button ID="btnGiaoHang" runat="server" CommandName="Giaohang" Text="Giao hàng" Visible='<%# Eval("TrangThai").ToString().Equals("Chưa giao")?true : false%>' CommandArgument='<%# Eval("MaPhieu") %>' />
                        <asp:Button ID="btnTraLai" runat="server" Text="Bị trả lại" Width="91px" Visible='<%# Eval("TrangThai").ToString().Equals("Đã giao")?true : false%>' CommandName="Tralai" CommandArgument='<%# Eval("MaPhieu") %>' />
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <EmptyDataTemplate>
                <asp:Label ID="lbldd" runat="server" ForeColor="#3366FF">Không có đơn đặt hàng nào được tìm thấy</asp:Label>
            </EmptyDataTemplate>
            <FooterStyle BackColor="White" ForeColor="#000066" />
            <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
            <RowStyle ForeColor="#000066" />
            <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
            <SortedAscendingCellStyle BackColor="#F1F1F1" />
            <SortedAscendingHeaderStyle BackColor="#007DBB" />
            <SortedDescendingCellStyle BackColor="#CAC9C9" />
            <SortedDescendingHeaderStyle BackColor="#00547E" />
        </asp:GridView>
        <%-- <asp:Button ID="btnChiTiet" runat="server" CommandName="Edit" Text="Xem chi tiết" CommandArgument='<%# Eval("MaPhieu") %>'
                                    OnClientClick='showPopup();return false();' UseSubmitBehavior="false" OrderID='<%#Eval("MaPhieu") %>'/>--%>
        <div id="dialog" title="Chi tiết hóa đơn">
        </div>
                    <asp:Label ID="lblThongBao" runat="server" ForeColor="#3366FF"></asp:Label>
    </div>
</asp:Content>

